package com.imy.common.base;

import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.imy.common.R;


/**
 * @ProjectName: yuanshen
 * @Package: com.hykb.yuanshenmap
 * @ClassName: BaseOnePxActivity
 * @Description: 描述
 * @Author: 蒋明伟
 * @CreateDate: 2021/4/8 17:40
 */
public abstract class BaseOnePxActivity extends AppCompatActivity {
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O
        || Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1) {
      setTheme(R.style.App_8);
    } else {
      setTheme(R.style.App);
    }
    super.onCreate(savedInstanceState);
    //判断安卓代码
    Window window = getWindow();
    window.setGravity(Gravity.LEFT | Gravity.TOP);
    WindowManager.LayoutParams params = window.getAttributes();
    params.x = 0;
    params.y = 0;
    params.height = 1;
    params.width = 1;
    window.setAttributes(params);
    initView(savedInstanceState);
  }

  protected abstract void initView(Bundle savedInstanceState);
}